/*
 * Project: Sudoku Explainer
 * Copyright (C) 2006-2007 Nicolas Juillerat
 * 
 * Project: Sudoku Hint Engine for Android
 * Copyright (C) 2010-2013 Emanuel Moecklin
 * 
 * Available under the terms of the Lesser General Public License (LGPL)
 */
package com.onegravity.sudoku.solver.checks;

import com.onegravity.sudoku.solver.HintResource;
import com.onegravity.sudoku.solver.HintType;
import com.onegravity.sudoku.solver.core.WarningHint;
import com.onegravity.sudoku.solver.data.Cell;
import com.onegravity.sudoku.solver.data.Grid;
import com.onegravity.sudoku.solver.util.HtmlLoader;

/**
 * A hint that just shows an arbitrary warning or information message
 */
public class WarningMessage extends WarningHint {

	private static final long serialVersionUID = -1783310658414990623L;
	
    private final HintResource hintResource;
    private final Cell cell;
    private final Object[] args;

    public WarningMessage(Grid grid, Cell cell, HintResource hintResource, Object... args) {
    	super(grid);
        this.cell = cell;
        this.hintResource = hintResource;
        this.args = args;
    }

    public Cell getCell() {
        return cell;
    }

    @Override
    public String toString() {
        return hintResource.toString(args);
    }

    @Override
    public String getHintHtml(HintType hintType) {
        String result = HtmlLoader.loadHtml(hintResource.hint());
        return HtmlLoader.format(result, args);
    }

}